-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FED-3254 Officially support Dart 3 #958
Conversation
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
aa16617
to
3a6933a
Compare
@@ -195,34 +195,31 @@ main() { | |||
}; | |||
|
|||
// Loop over the deprecated lifecycle methods | |||
legacyLifecycleMethodsMap.keys.forEach((lifecycle) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were some syntax shenanigans going on here, it looks like from a TS/Dart arrow function syntax mixup 🙂.
This set of curly braces and the ones in the below for-loop are actually being interpreted as set literals, not blocks, were causing warnings.
So, I fixed that and switched from forEach to a for-loop while I was at it.
@@ -132,7 +132,7 @@ class CssValue implements Comparable<CssValue> { | |||
|
|||
/// Returns whether this value's [number] and [unit] are equal to that of [other]. | |||
@override | |||
bool operator ==(dynamic other) { | |||
bool operator ==(Object other) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a new built-in Dart warning; apparently ==
will never be passed a null value (== null
bypasses operator==
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting
@@ -63,21 +63,18 @@ mixin DisposableManagerProxy on react.Component implements DisposableManagerV7 { | |||
_getDisposableProxy().listenToStream(stream, onData, | |||
onError: onError, onDone: onDone, cancelOnError: cancelOnError); | |||
|
|||
@override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These weren't actually overrides and were infos in Dart 2, but got upgraded to warnings in Dart 3.
@@ -96,13 +96,6 @@ void main() { | |||
testValue: 'test value', | |||
); | |||
}); | |||
test('nullable dynamic with extraneous ? syntax', () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These test cases tested a dynamic?
type as an edge case, which now warns instead of infos when used (because the ?
is unnecessary).
I tried suppressing those warnings, but dynamic?
also appears in the generated part file, and there's no easy way to suppress that warning for just that file.
Since this was an edge-case that warns when the user authors it, preserving the exact type is covered by other test cases, and we originally added this case "just in case", I opted to just remove this case here and in other files.
@@ -15,8 +15,9 @@ analyzer: | |||
missing_return: warning | |||
# Override workiva_analysis_options upgrade to warning | |||
unused_import: info | |||
import_of_legacy_library_into_null_safe: warning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This no longer exists in Dart 3
QA+1 CI passes on all combinations of Dart 2 and analyzer. There are validations in place to check that pub resolves the correct analyzer version. |
@Workiva/release-management-p |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from RM
Related react-dart PR: Workiva/react-dart#409
Motivation
We should support Dart 3.
over_react can currently be consumed in Dart 3, despite not supporting it in its SDK constraints, due to the way Dart 3 treats null-safe packages as compatible.
However, we don't officially support Dart 3, and our automated CI checks don't validate that it works properly in Dart 3.
Also, we still need to support Dart 2 for the time being, so ideally we'd be able to support both Dart 2 and 3 in the same over_react version, and run CI against each Dart version.
Changes
dart-2-only
tag for VM tests that only apply in Dart 2Caution
There's a bug in Dart >=3.3.0 <3.5.0 that breaks react-dart behavior in DDC of certain functions passed to components, such as refs and potentially JS callback props: dart-lang/sdk#56897
We can't prevent users on those versions from pulling in react-dart, since they can already resolve to null-safe versions that have already been published.
So, consumers will just have to avoid those versions of Dart, or use dart2js during development or tests.
If needed, we could potentially follow up with a warning that detects this bug and provides a helpful error.
Release Notes
Review
See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.
Please review:
QA Checklist
tools/analyzer_plugin/playground/
in an IDE using Dart 3 (just need topub get
in that directory and you're good)Merge Checklist
While we perform many automated checks before auto-merging, some manual checks are needed: